package cn.iocoder.yudao.module.reading.controller.app.record.vo;

import cn.iocoder.yudao.module.reading.framework.vo.BaseUrlConvertVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 阅读记录历史响应 VO
 *
 * @author 李晨
 */
@Schema(description = "阅读记录历史响应 VO")
@Data
@EqualsAndHashCode(callSuper = false)
public class ReadingHistoryRespVO extends BaseUrlConvertVO {

    @Schema(description = "记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long id;

    @Schema(description = "绘本ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
    private Long bookId;

    @Schema(description = "绘本标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "Fun at the Beach")
    private String bookTitle;

    @Schema(description = "绘本封面", example = "https://example.com/cover.jpg")
    private String bookCover;

    @Schema(description = "绘本语言", example = "en")
    private String bookLanguage;

    @Schema(description = "绘本集ID", example = "1")
    private Long bookSetId;

    @Schema(description = "绘本集标题", example = "牛津树1级")
    private String bookSetTitle;

    @Schema(description = "是否完成阅读", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
    private Boolean isCompleted;

    @Schema(description = "阅读进度", requiredMode = Schema.RequiredMode.REQUIRED, example = "1.0")
    private Double readingProgress;

    @Schema(description = "最后阅读页码", example = "15")
    private Integer lastPage;

    @Schema(description = "阅读时长（秒）", example = "300")
    private Integer readingTime;

    @Schema(description = "阅读模式", example = "self_reading")
    private String readingMode;

    @Schema(description = "首次阅读时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime firstReadAt;

    @Schema(description = "最后阅读时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime lastReadAt;

    @Schema(description = "完成阅读时间")
    private LocalDateTime completedAt;

    /**
     * 转换URL字段
     * 将相对路径转换为完整URL
     */
    @Override
    public void convertUrls() {
        this.bookCover = convertUrl(this.bookCover);
    }
}
